package com.juzipi.controller;

import com.juzipi.common.core.BaseController;
import com.juzipi.common.tools.Result;
import com.juzipi.service.PaperService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

/**
 * @Author juzipi
 * @Date 2021/4/14 17:20
 * @Info 试卷
 */

@RestController
@RequestMapping("paper")
public class PaperController extends BaseController {


    @Autowired
    private PaperService paperService;


    @PreAuthorize("hasAnyRole('user','admin','super')")
    @GetMapping("list")
    @ApiOperation("获取所有试卷")
    public Result queryAllPaper(){
        return JudgeResult(paperService.queryAllPaper());
    }



    @PreAuthorize("hasAnyRole('user','admin','super')")
    @GetMapping("get/{paperId}")
    @ApiOperation("根据id获取试卷")
    public Result queryPaperById(@PathVariable(value = "paperId") Long paperId){
        return JudgeResult(paperService.queryPaperById(paperId));
    }




}
